package com.ken.autocode.tools.generator.executor;
import com.ken.autocode.tools.generator.config.ConfigInfo;
import com.ken.autocode.tools.generator.util.FieldUtils;
import com.ken.autocode.tools.generator.util.TableInfo;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


public class MysqlGenerator {

    /**
     * 获得表信息
     * @param tableNames 表集合
     * @return
     * @throws SQLException
     */
    public static List<TableInfo> getTableInfo(Map<String, String> tableNames) throws SQLException {
        List<TableInfo> tables = new ArrayList<TableInfo>();
        for (String key : tableNames.keySet()) {
            TableInfo ti = new TableInfo(key, tableNames.get(key), FieldUtils.getMysqlFieldInfo(key, ConfigInfo.DB_URL, ConfigInfo.DB_USERL,
                    ConfigInfo.DB_PWD));
            tables.add(ti);
        }
        return tables;
    }


}
